/*
 * @ : Copyright (c) 2021 Phytium Information Technology, Inc. 
 *  
 * SPDX-License-Identifier: Apache-2.0.
 * 
 * @Date: 2021-08-25 13:28:18
 * @LastEditTime: 2021-08-25 17:17:55
 * @Description:  This files is for static config of wdt ctrl 
 * 
 * @Modify History: 
 *  Ver   Who        Date         Changes
 * ----- ------     --------    --------------------------------------
 * 1.0   Wangxiaodong   2021/8/25   init
 */
#include "parameters.h"
#include "fwdt.h"

/* default configs of wdt ctrl */
static const FWdtConfig FWdtConfigTbl[WDT_INSTANCE_NUM] =
    {
        {.instance_id = WDT_INSTANCE_0,
         .refresh_baseAddr = WDT0_REFRESH_BASE,
         .control_baseAddr = WDT0_CONTROL_BASE,
         .irq_num = WDT0_INTR_IRQ,
         .irq_prority = 0,
         .instance_name = "WDT-0"
    },

    {
        .instance_id = WDT_INSTANCE_1,
        .refresh_baseAddr = WDT1_REFRESH_BASE,
        .control_baseAddr = WDT1_CONTROL_BASE,
        .irq_num = WDT1_INTR_IRQ,
        .irq_prority = 0,
        .instance_name = "WDT-1"
    }   
};

/**
 * @name: WdtLookupConfig
 * @msg: get wdt configs by id
 * @return {*}
 * @param {u32} instanceId, id of wdt ctrl
 */
const FWdtConfig *FWdtLookupConfig(u32 instance_id)
{
    const FWdtConfig *pconfig = NULL;
    u32 index;

    for (index = 0; index < (u32)WDT_INSTANCE_NUM; index++)
    {
        if (FWdtConfigTbl[index].instance_id == instance_id)
        {
            pconfig = &FWdtConfigTbl[index];
            break;
        }
    }

    return (FWdtConfig *)pconfig;  
}